@@ -20,6 +20,7 @@ import android.view.LayoutInflater; |
||
20 | 20 |
import android.view.MenuItem; |
21 | 21 |
import android.view.View; |
22 | 22 |
import android.view.ViewGroup; |
23 |
+import android.view.animation.CycleInterpolator; |
|
23 | 24 |
import android.widget.ImageButton; |
24 | 25 |
import android.widget.ImageView; |
25 | 26 |
import android.widget.TextView; |
@@ -31,10 +32,11 @@ import com.android.common.utils.TimeUtils; |
||
31 | 32 |
import com.android.views.indicators.Indicator; |
32 | 33 |
import com.android.views.indicators.IndicatorViewPager; |
33 | 34 |
import com.android.views.indicators.SpringBar; |
35 |
+import com.hanks.htextview.HTextView; |
|
36 |
+import com.hanks.htextview.HTextViewType; |
|
34 | 37 |
import com.umeng.analytics.MobclickAgent; |
35 | 38 |
|
36 | 39 |
import java.io.File; |
37 |
-import java.sql.Time; |
|
38 | 40 |
|
39 | 41 |
import ai.pai.client.R; |
40 | 42 |
import ai.pai.client.beans.GroupInfo; |
@@ -63,13 +65,22 @@ public class MainActivity extends AppCompatActivity |
||
63 | 65 |
private PersonInfoPopup personInfoPopup; |
64 | 66 |
private ImageButton callGuideBtn; |
65 | 67 |
private ImageButton gatherBtn; |
68 |
+ private ImageButton scanQRBtn; |
|
69 |
+ private ImageButton addGroupBtn; |
|
66 | 70 |
private TextView gatherInfoTextView; |
71 |
+ private HTextView scanQRHintTextView; |
|
72 |
+ private HTextView addGroupHintTextView; |
|
73 |
+ private boolean isGuideShow; |
|
74 |
+ private boolean isDestroy; |
|
67 | 75 |
|
68 | 76 |
@Override |
69 | 77 |
protected void onCreate(Bundle savedInstanceState) { |
70 | 78 |
super.onCreate(savedInstanceState); |
71 | 79 |
setContentView(R.layout.activity_main); |
72 |
- |
|
80 |
+ scanQRHintTextView = (HTextView)findViewById(R.id.tv_scan_qr_hint); |
|
81 |
+ addGroupHintTextView = (HTextView)findViewById(R.id.tv_add_group_hint); |
|
82 |
+ scanQRBtn = (ImageButton)findViewById(R.id.floating_btn_scan); |
|
83 |
+ addGroupBtn = (ImageButton)findViewById(R.id.floating_btn_add); |
|
73 | 84 |
drawer = (DrawerLayout) findViewById(R.id.drawer_layout); |
74 | 85 |
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); |
75 | 86 |
navigationView.setNavigationItemSelectedListener(this); |
@@ -124,6 +135,7 @@ public class MainActivity extends AppCompatActivity |
||
124 | 135 |
|
125 | 136 |
@Override |
126 | 137 |
protected void onDestroy() { |
138 |
+ isDestroy = true; |
|
127 | 139 |
super.onDestroy(); |
128 | 140 |
} |
129 | 141 |
|
@@ -406,4 +418,42 @@ public class MainActivity extends AppCompatActivity |
||
406 | 418 |
} |
407 | 419 |
} |
408 | 420 |
|
421 |
+ public void showGuideAnim(){ |
|
422 |
+ if(isGuideShow){ |
|
423 |
+ return; |
|
424 |
+ } |
|
425 |
+ isGuideShow = true; |
|
426 |
+ scanQRHintTextView.setVisibility(View.VISIBLE); |
|
427 |
+ scanQRHintTextView.setAnimateType(HTextViewType.TYPER); |
|
428 |
+ scanQRHintTextView.animateText(getString(R.string.click_to_scan_qr)); |
|
429 |
+ scanQRBtn.animate().translationX(10).scaleX(1.2f).scaleY(1.2f).setInterpolator(new CycleInterpolator(5)).setDuration(2000).start(); |
|
430 |
+ scanQRHintTextView.postDelayed(new Runnable() { |
|
431 |
+ @Override |
|
432 |
+ public void run() { |
|
433 |
+ if(isDestroy){ |
|
434 |
+ return; |
|
435 |
+ } |
|
436 |
+ if(scanQRHintTextView!=null && scanQRHintTextView.isShown()){ |
|
437 |
+ scanQRHintTextView.setVisibility(View.GONE); |
|
438 |
+ } |
|
439 |
+ if(addGroupHintTextView!=null){ |
|
440 |
+ addGroupHintTextView.setVisibility(View.VISIBLE); |
|
441 |
+ addGroupHintTextView.setAnimateType(HTextViewType.TYPER); |
|
442 |
+ addGroupHintTextView.animateText(getString(R.string.click_to_add_group)); |
|
443 |
+ addGroupBtn.animate().translationX(10).scaleX(1.2f).scaleY(1.2f).setInterpolator(new CycleInterpolator(5)).setDuration(2000).start(); |
|
444 |
+ addGroupHintTextView.postDelayed(new Runnable() { |
|
445 |
+ @Override |
|
446 |
+ public void run() { |
|
447 |
+ if(isDestroy){ |
|
448 |
+ return; |
|
449 |
+ } |
|
450 |
+ if(addGroupHintTextView!=null && addGroupHintTextView.isShown()){ |
|
451 |
+ addGroupHintTextView.setVisibility(View.GONE); |
|
452 |
+ } |
|
453 |
+ } |
|
454 |
+ },3000); |
|
455 |
+ } |
|
456 |
+ } |
|
457 |
+ },3000); |
|
458 |
+ } |
|
409 | 459 |
} |
@@ -38,6 +38,7 @@ import java.util.Arrays; |
||
38 | 38 |
import java.util.HashMap; |
39 | 39 |
|
40 | 40 |
import ai.pai.client.R; |
41 |
+import ai.pai.client.activity.MainActivity; |
|
41 | 42 |
import ai.pai.client.adapter.RecentPhotoStaggeredAdapter; |
42 | 43 |
import ai.pai.client.beans.GroupPhotoItem; |
43 | 44 |
import ai.pai.client.db.DBService; |
@@ -320,6 +321,13 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
320 | 321 |
DBService.getInstance(context).addRecentPhotos(photoItems); |
321 | 322 |
isDataRefreshed = true; |
322 | 323 |
} |
324 |
+ if(isAdded() && refreshAdapter!=null && refreshAdapter.getPhotoList()!=null && refreshAdapter.getPhotoList().size()==0){ |
|
325 |
+ if(getActivity() instanceof MainActivity){ |
|
326 |
+ MainActivity mainActivity = (MainActivity)getActivity(); |
|
327 |
+ mainActivity.showGuideAnim(); |
|
328 |
+ } |
|
329 |
+ } |
|
330 |
+ |
|
323 | 331 |
} |
324 | 332 |
}; |
325 | 333 |
fetchPhotosTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), UrlContainer.HOME_PHOTO_URL); |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 3 |
android:layout_width="match_parent" |
4 | 4 |
android:layout_height="match_parent" |
5 |
- android:fitsSystemWindows="true" |
|
6 |
- > |
|
5 |
+ xmlns:htext="http://schemas.android.com/apk/res-auto" |
|
6 |
+ android:fitsSystemWindows="true"> |
|
7 | 7 |
|
8 | 8 |
<include layout="@layout/content_main" /> |
9 | 9 |
|
@@ -18,6 +18,20 @@ |
||
18 | 18 |
android:layout_marginTop="3dp" |
19 | 19 |
android:background="@drawable/floating_add_selector"/> |
20 | 20 |
|
21 |
+ <com.hanks.htextview.HTextView |
|
22 |
+ android:id="@+id/tv_add_group_hint" |
|
23 |
+ android:layout_width="match_parent" |
|
24 |
+ android:layout_height="56dp" |
|
25 |
+ android:gravity="center" |
|
26 |
+ android:text="@string/click_to_add_group" |
|
27 |
+ android:layout_gravity="bottom|start" |
|
28 |
+ android:layout_marginRight="60dp" |
|
29 |
+ android:layout_marginBottom="6dp" |
|
30 |
+ android:layout_marginTop="3dp" |
|
31 |
+ htext:animateType="typer" |
|
32 |
+ android:visibility="gone" |
|
33 |
+ android:textSize="17sp"/> |
|
34 |
+ |
|
21 | 35 |
<ImageButton |
22 | 36 |
android:id="@+id/floating_btn_scan" |
23 | 37 |
android:layout_width="56dp" |
@@ -27,6 +41,20 @@ |
||
27 | 41 |
android:layout_marginBottom="66dp" |
28 | 42 |
android:background="@drawable/floating_qrscan_selector"/> |
29 | 43 |
|
44 |
+ <com.hanks.htextview.HTextView |
|
45 |
+ android:id="@+id/tv_scan_qr_hint" |
|
46 |
+ android:layout_width="match_parent" |
|
47 |
+ android:layout_height="56dp" |
|
48 |
+ android:gravity="center" |
|
49 |
+ android:text="@string/click_to_scan_qr" |
|
50 |
+ android:layout_gravity="bottom|start" |
|
51 |
+ android:layout_marginRight="60dp" |
|
52 |
+ android:layout_marginBottom="66dp" |
|
53 |
+ android:layout_marginTop="3dp" |
|
54 |
+ htext:animateType="typer" |
|
55 |
+ android:visibility="gone" |
|
56 |
+ android:textSize="17sp"/> |
|
57 |
+ |
|
30 | 58 |
<ImageButton |
31 | 59 |
android:id="@+id/floating_btn_call" |
32 | 60 |
android:layout_width="56dp" |
@@ -252,4 +252,8 @@ |
||
252 | 252 |
<string name="group_admin_not_me">您不是该群的管理员,无法删除</string> |
253 | 253 |
|
254 | 254 |
<string name="click_to_take_photo">点我拍照,记录您的精彩瞬间吧</string> |
255 |
+ |
|
256 |
+ <string name="click_to_add_group">点我可以新建拍照群组哦</string> |
|
257 |
+ |
|
258 |
+ <string name="click_to_scan_qr"> 点我扫码加入朋友建的群组吧</string> |
|
255 | 259 |
</resources> |